<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE>
<html>
<head>
<jsp:include page="../header.jsp">
	<jsp:param value="录入学员" name="title"/>
</jsp:include>
<link href="static/css/base-css.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="static/js/student.js"></script>
<script type="text/javascript">
$(function(){
	//刷新 
	$("#refresh").on('click', function(){
		location.replace("${basePath}${url}");
	});
});

function cancle(){
	$('.ui.modal').modal('hide');
}
</script>
</head>
<body>
	<jsp:include page="../menu/menue.jsp"></jsp:include>
	<jsp:include page="stu_checkout.jsp"></jsp:include>
	<div class="teacher-content" style="margin-left: 150px; margin-right: 100px; margin-top:50px;">
	<table class="ui sortable celled table">
    <thead>
    <tr>
    	<th colspan="7" style="vertical-align:middle">
    	<div style="float:left;">${url eq 'potential' ?'分配学生':'已分配学员'}</div>
    		<form>
		    	<div class="ui mini icon input" style="float: right;">
		  			<input type="text" placeholder="请输入搜索关键字" name="userName" value="${param.userName }">
		  			<i class="search icon"></i>
				</div>
			</form>
    	</th>
    </tr>
    <tr>
    	<th colspan="7">
    		<c:choose>
    			<c:when test="${allocation eq '未分配' }">
    				<a class="ui teal basic button" tabindex="0" href="oneKeyAllocation">一键分配</a>
    			</c:when>
    			<c:otherwise>
    				
    			</c:otherwise>
    		</c:choose>
    		<c:choose>
    			<c:when test="${allocation eq '未分配' }">
    				<div class="ui teal basic button" tabindex="0" onclick="allocation()">分配学生</div>
    			</c:when>
    			<c:otherwise>
    				
    			</c:otherwise>
    		</c:choose>
    		<c:choose>
    			<c:when test="${allocation eq '未分配' }">
    				<div class="ui teal basic button" tabindex="0" onclick="addStudent()">导入学生</div>
    			</c:when>
    			<c:otherwise>
    				
    			</c:otherwise>
    		</c:choose>
    		<div class="ui teal basic button" tabindex="0" id="delete">删除</div>
    		<div class="ui teal basic button" tabindex="0" id="refresh">刷新</div>
    		<div class="ui buttons" style="float:right;">
    		<c:choose>
    			<c:when test="${allocation eq '未分配' }">
				  <a class="ui button" style="background: #666; color:#fff" href="potential">所有客户</a>
				  <a class="ui button " tabindex="0" href="already/allocation/stu">已分配</a>
			  </c:when>
    			<c:otherwise>
				  <a class="ui button" href="potential">所有客户</a>
				  <a class="ui button " tabindex="0" href="already/allocation/stu" style="background: #666; color:#fff">已分配</a>
    			</c:otherwise>
    		</c:choose>
			</div>
    	</th>
    </tr> 
      <tr id="tr1">
      	<th>
	      	<div class="ui checkbox">
				<input type="checkbox" id="checkAll">
			</div>
		</th>
        <th>姓名</th>
        <th>性别</th>
        <th>来源</th>
        <th>电话</th>
        <th>创建时间</th>
        <th>分配状态</th>
      </tr>
    </thead>
    <tbody>
    <c:forEach items="${stuList }" var="stu">
      <tr id ="tr2">
     	 <td>
	      	<div class="ui checkbox">
				<input type="checkbox" class="item-check" value="${stu.id}">
			</div>
		</td>
        <td>
 			 <a class="browse item" href="student/add?sid=${stu.id }" style="color:#666">
 			   ${stu.name}
 			 </a>
			  <div class="ui fluid popup  bottom left transition hidden" style="max-width:300px;">
			    <div class="ui four column relaxed divided grid" >
			      <div class="column" style="text-align: left;">
			        <h5 class="ui header" style="width:200px;">详细资料</h5>
			        <div class="ui link list">
			          <a class="item" style="width:200px;">学历：${stu.education }</a>
			          <a class="item" style="width:200px;">身份证号码：${stu.idCard}</a>
			          <a class="item" style="width:200px;">QQ号码：${stu.qq}</a>
			          <a class="item" style="width:200px;">父亲姓名：${stu.fatherName }</a>
			          <a class="item" style="width:200px;">父亲电话：${stu.fatherTel }</a>
			          <a class="item" style="width:200px;">母亲姓名：${stu.motherName }</a>
			          <a class="item" style="width:200px;">母亲电话：${stu.motherTel }</a>
			          <a class="item" style="width:200px;">录入者：${stu.creator }</a>
			          <a class="item" style="width:200px;">状态：${stu.status }</a>
			        </div>
			      </div>
			    </div>
			  </div>
        </td>
        <td>${stu.gender}</td>
        <td>${stu.source }</td>
        <td>${stu.phone}</td>
        <td><fmt:formatDate value="${stu.createTime}" type="both"/></td>
        <td class="negative">${stu.isAllocation }</td>
      </tr>
      </c:forEach>
      <c:if test="${empty stuList}">
		<tr>
			<td style="text-align: center;" colspan="8">暂无记录</td>
		</tr>
	  </c:if>
    </tbody>
  </table>
  
  	<c:if test="${totalPage > 1}">
  		<c:if test="${allocation=='未分配' }">
			<div class="page">
				<a <c:if test="${page!=1}">href="potential?page=1${queryString}"</c:if>
					class="${page == 1?'disable':''}" style="color:#666"><i class="fast backward icon"></i>首页
				</a>
				<a <c:if test="${page!=1}">href="potential?page=${page-1}${queryString}"</c:if>
					class="${page == 1?'disable':''}" style="color:#666"><i class="backward icon"></i>上一页
				</a>
				<a <c:if test="${page!=totalPage}">href="potential?page=${page+1 }${queryString}"</c:if>
					class="${page == totalPage?'disable':''}" style="color:#666">下一页<i class="forward icon"></i>
				</a>
				<a <c:if test="${page!=totalPage}">href="potential?page=${totalPage }${queryString}"</c:if>
					class="${page == totalPage?'disable':''}" style="color:#666">尾页<i class="fast forward icon"></i>
				</a>
				<span style="float:right">${page}/${totalPage }</span>
			</div>
		</c:if>
	</c:if>
	<c:if test="${totalPage > 1}">
  		<c:if test="${allocation=='已分配' }">
			<div class="page">
				<a <c:if test="${page!=1}">href="already/allocation/stu?page=1${queryString}"</c:if>
					class="${page == 1?'disable':''}" style="color:#666"><i class="fast backward icon"></i>首页
				</a>
				<a <c:if test="${page!=1}">href="already/allocation/stu?page=${page-1}${queryString}"</c:if>
					class="${page == 1?'disable':''}" style="color:#666"><i class="backward icon"></i>上一页
				</a>
				<a <c:if test="${page!=totalPage}">href="already/allocation/stu?page=${page+1 }${queryString}"</c:if>
					class="${page == totalPage?'disable':''}" style="color:#666">下一页<i class="forward icon"></i>
				</a>
				<a <c:if test="${page!=totalPage}">href="already/allocation/stu?page=${totalPage }${queryString}"</c:if>
					class="${page == totalPage?'disable':''}" style="color:#666">尾页<i class="fast forward icon"></i>
				</a>
				<span style="float:right">${page}/${totalPage }</span>
			</div>
		</c:if>
	</c:if>
  </div>

</body>
</html>
